import Vue from 'vue'
import App from './App.vue'
import iView from 'iview'
import router from '@/router'
import store from '@/store'
import vuescroll from 'vuescroll'
import { getRouter } from '@/utils'
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
import echarts from 'echarts'
import '@/main.less'
import '@/assets/css/_common.css'
import '@/assets/css/icon-font/iconfont.css'
import config from '@/config/index'
import 'vuescroll/dist/vuescroll.css'
Vue.use(Viewer, {
  defaultOptions: {
      zIndex: 9999
  }
})
Vue.config.productionTip = true
Vue.prototype.$config = config
Vue.prototype.$echarts = echarts
Vue.use(iView)
Vue.use(vuescroll)
if (store.state.user.token && store.state.user.token !== 'undefined') {
  let routes = [],
  menuList = JSON.parse(localStorage.menus)
  getRouter(routes, menuList)
  router.addRoutes(routes)
}

new Vue({
  router,
  store,
  render: h => h(App),
}).$mount('#app')
